CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

INCLUDE (CMakeForceCompiler)
#CMAKE_FORCE_C_COMPILER(gcc44 "GCC 4.4")
#CMAKE_FORCE_CXX_COMPILER(g++44 "GCC 4.4")

AUX_SOURCE_DIRECTORY(FastDB FASTDB_SOURCES)
AUX_SOURCE_DIRECTORY(FileSystem FS_SOURCES)
AUX_SOURCE_DIRECTORY(Thread THREAD_SOURCES)
AUX_SOURCE_DIRECTORY(tests TESTSUITE)

INCLUDE_DIRECTORIES(/usr/local/include /usr/include
        ${CMAKE_CURRENT_SOURCE_DIR})

ADD_LIBRARY(filesystem STATIC ${FS_SOURCES})
ADD_LIBRARY(thread STATIC ${THREAD_SOURCES})
ADD_LIBRARY(fastdb STATIC ${FASTDB_SOURCES})

INCLUDE(CheckIncludeFileCXX)
INCLUDE(FindBoost)
FIND_PACKAGE(Boost COMPONENTS unit_test_framework REQUIRED)

ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)

SET(CMAKE_CXX_FLAGS_DEBUG "-g3 -O0 -Wall -Werror")
SET(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -Wall -Werror")

SET(CMAKE_BUILD_TYPE Debug)

FIND_LIBRARY(PTHREAD_LIB NAMES thr pthread PATHS /usr/lib)

ADD_EXECUTABLE(fastls_testsuite ${TESTSUITE})
TARGET_LINK_LIBRARIES(fastls_testsuite fastdb filesystem thread 
	${PTHREAD_LIB} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
ENABLE_TESTING()
ADD_TEST(fastls_testsuite fastls_testsuite)

